package cn.edu.sgu.www.pms.dto;

import cn.edu.sgu.www.pms.consts.CustomMessages;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Data
@ApiModel
public class PermissionDTO implements Serializable {
    private static final long serialVersionUID = 18L;

    @NotBlank(message = CustomMessages.ID_NOT_NULL)
    @ApiModelProperty(value = "权限ID", required = true)
    private String id;

    /**
     * 权限名称
     */
    @NotBlank(message = "权限名称" + CustomMessages.NOT_NULL)
    @ApiModelProperty(value = "权限名称", required = true)
    private String name;

    /**
     * 权限类型
     * 0-父权限（控制器类）；1-子权限（接口方法）
     */
    @NotNull(message = "权限类型" + CustomMessages.NOT_NULL)
    @ApiModelProperty(value = "权限类型", required = true)
    private Integer type;

    /**
     * 是否远程（RPC）接口
     * 0-普通接口；1-远程接口
     */
    @NotNull(message = "接口类型" + CustomMessages.NOT_NULL)
    @ApiModelProperty(name = "接口类型", required = true)
    private Integer remote;

    /**
     * 请求路径
     */
    @NotBlank(message = "请求路径" + CustomMessages.NOT_NULL)
    @ApiModelProperty(value = "请求路径")
    private String url;

    /**
     * 权限值
     */
    @NotBlank(message = "权限值" + CustomMessages.NOT_NULL)
    @ApiModelProperty(value = "权限值", required = true)
    private String value;

    /**
     * 请求方式 0-get；1-post
     */
    @NotNull(message = "权限类型" + CustomMessages.NOT_NULL)
    @ApiModelProperty(value = "请求方式", required = true)
    private Integer method;

    /**
     * 是否允许匿名访问 0-不允许；1-允许
     */
    @NotNull(message = "匿名访问" + CustomMessages.NOT_NULL)
    @ApiModelProperty(value = "是否允许匿名访问", required = true)
    private Integer anonymity;

    /**
     * 父级权限ID
     */
    @ApiModelProperty(value = "父级权限ID")
    private String parentId;

    /**
     * 应用ID
     */
    @NotNull(message = "应用" + CustomMessages.ID_NOT_NULL)
    @ApiModelProperty(value = "应用ID", required = true)
    private Integer serviceId;
}